home *** CD-ROM | disk | FTP | other *** search
/ Aminet 40 / Aminet 40 (2000)(Schatztruhe)[!][Dec 2000].iso / Aminet / comm / irc / KuangEleven3Gm.lha / Kuang Eleven 3 / Rexx / CTCP / VOTE.amirx < prev    next >
Text File  |  1998-05-09  |  1KB  |  49 lines

  1. /* $VER: VOTE.amirx 3.0 (9.5.98) Voteman CTCP plugin
  2. */
  3. options results
  4. parse arg ':'prefix' 'type' 'channel' :'text
  5. parse var prefix nick'!'user'@'host
  6. div='01'x
  7. parse var text (div) command option . (div)
  8. if upper(command)~='VOTE' then exit
  9.  
  10. /* Usual startup lines */
  11.  
  12. /* Check if he voted twice */
  13. hosts=getclip('st_vt_voters')
  14. if find(hosts,host)~=0 then do
  15.     notice(nick,'You have voted already')
  16.     cecho(nick 'voted twice')
  17.     exit
  18. end
  19.  
  20. /* Check if he voted correctly */
  21. options=getclip('st_vt_opts')
  22. if options='' then do
  23.     notice(nick,'There is no vote right now.')
  24.     cecho(nick 'tried to vote.')
  25.     exit
  26. end
  27. if ~datatype(option,'W') then signal badargs
  28. if options<option|option<0 then signal badargs
  29.  
  30. /* Register vote */
  31. count=getclip('st_vt_cnt'option)
  32. if count='' then count=1
  33. else count=count+1
  34. call setclip('st_vt_cnt'option,count)
  35. call setclip('st_vt_voters',getclip('st_vt_voters') host)
  36. users=getclip('st_vt_users')
  37. if find(users,nick)~=0 then call setclip('st_vt_users',delword(users,find(users,nick),1))
  38. notice(nick,'Thank you for voting : 'option'.' getclip('st_vt_desc'option))
  39. cecho(nick 'voted' option'.Total :'count'.')
  40. exit
  41.  
  42. badargs:
  43. notice(nick,option 'is not a valid vote.')
  44. cecho(nick 'voted ilegale :' option '(' text')')
  45. exit
  46. bld:;bld = x2c('02');return bld||arg(1)||bld
  47. notice:;'QueueRAW NOTICE' arg(1) ':'arg(2);return 0
  48. cecho:;"ECHO P="d2c(27)"b«Vote»" arg(1);return 0
  49.